#include<iostream>
using namespace std;

class CRectangle {  
protected:  
    double width, height;  
public:  
    CRectangle(int wid=1, int hei=1):width(wid),height(hei){}  
    int getWidth(){return width;}  
    void setWidth(int newWid){width = newWid;}  
    int getHeight(){return height;}  
    void setHeight(int newHei){height = newHei;}  
    int area(){return width*height;}//面积  
    int perimeter(){return (width+height)*2;}//周长  
    void scale(double fw, double fh) {width*=fw; height*=fh;}//缩放  
};  
class CSquare:public CRectangle
{
 
 //派生类调用基类的构造函数
   public:
    CSquare(int a):CRectangle(a,a){}
  //派生类调用基类的成员函数
  public:
    void scale(double fe) 
    {
        CRectangle::scale(fe,fe);
        }//缩放 

};
int main()
{
    CRectangle r(2,3);
    cout<<"Rectangle:"<<r.getHeight()<<","<<r.getWidth()<<endl;
    cout<<"area="<<r.area()<< "\tperimeter= "<<r.perimeter()<<endl;
     r.scale(3, 4);
    cout<<"Rectangle:"<<r.getHeight()<<","<<r.getWidth()<<endl;
    cout<<"area="<<r.area()<< "\tperimeter= "<<r.perimeter()<<endl;

    CSquare  s(1);
    cout<<"Square:"<<s.getHeight()<<","<<s.getWidth()<<endl;
    cout<<"area="<<s.area()<< "\tperimeter= "<<s.perimeter()<<endl;
    s.scale(2);
    cout<<"Square:"<<s.getHeight()<<","<<s.getWidth()<<endl;
    cout<<"area="<<s.area()<< "\tperimeter= "<<s.perimeter()<<endl;
    return 0;
}
